/**
 * 
 */
package org.huanglei.account.bean;

import java.text.SimpleDateFormat;

/**
 * @author huanglei
 * @data Jul 12, 2012
 * @tag 消费账单明细
 */
public class Account {

	/**
	 * 编号
	 */
	private int id = 0;

	/**
	 * 类型
	 */
	private String type = null;
	/**
	 * 金额
	 */
	private double money = 0.00;
	/**
	 * 日期
	 */
	private long date = 0L;

	/**
	 * 日期格式化字符串
	 */
	private String dateStr = null;

	/**
	 * 备注
	 */
	private String memo = null;

	private Account() {

	}

	public static Account newAccount(int id) {
		Account account = new Account();
		account.setId(id);
		return account;
	}

	public static Account newAccount() {
		return newAccount(0);
	}

	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	private void setId(int id) {
		this.id = id;
	}

	public String getType() {
		return type;
	}

	public Account setType(String type) {
		this.type = type;
		return this;
	}

	public double getMoney() {
		return money;
	}

	public Account setMoney(double money) {
		this.money = money;
		return this;
	}

	public long getDate() {
		return date;
	}

	public String getDateString() {
		return dateStr;
	}

	public Account setDate(long date) {
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
		dateStr = format.format(date);
		this.date = date;
		return this;
	}

	public String getMemo() {
		return memo;
	}

	public Account setMemo(String memo) {
		this.memo = memo;
		return this;
	}

	@Override
	public String toString() {
		return "Account [type=" + type + ", money=" + money + ", date=" + date
				+ ", memo=" + memo + "]";
	}

}
